/** @typedef {import('../types').IMonoDevInfo} IDevInfo */
const { getCmdKeywordName, getNameData, helMonoLog } = require('../util');
const { prepareHelEntryForMainAndDeps } = require('../entry');

/**
 * 执行 npm start .init xx-hub 命令
 */
exports.execInit = function (/** @type {IDevInfo} */ devInfo) {
  helMonoLog('isForRootHelDir false');
  const mayPkgOrDir = getCmdKeywordName(3);
  const nameData = getNameData(mayPkgOrDir, devInfo);
  prepareHelEntryForMainAndDeps({ isForRootHelDir: false, devInfo, nameData });
};

/**
 * 执行 npm start .init-proxy xx-hub 命令
 */
exports.execInitProxy = function (/** @type {IDevInfo} */ devInfo) {
  helMonoLog('isForRootHelDir true');
  const mayPkgOrDir = getCmdKeywordName(3);
  const nameData = getNameData(mayPkgOrDir, devInfo);
  prepareHelEntryForMainAndDeps({ isForRootHelDir: true, devInfo, nameData });
};
